<?php
class UserForm extends Zend_Form
{
    public function __construct($options = null)
    {
        parent::__construct($options);
        $this->setName('user');

        //$id = new Zend_Form_Element_Hidden('id');

        $name = new Zend_Form_Element_Text('name');
        $name
            ->setLabel('Name')
            ->setRequired(true)
            ->addFilter('StripTags')
            ->addFilter('StringTrim')
            ->addValidator('NotEmpty')
            ;

        $login = new Zend_Form_Element_Text('login');
        $login
            ->setLabel('Login')
            ->setRequired(true)
            ->addFilter('StripTags')
            ->addFilter('StringTrim')
            ->addValidator('NotEmpty')
            ;

        $pass = new Zend_Form_Element_Password('password');
        $pass
            ->setLabel('Password')
            ->setRequired(true)
            ->addFilter('StripTags')
            ->addFilter('StringTrim')
            ->addValidator('NotEmpty')
            ;

        $email = new Zend_Form_Element_Text('email');
        $email
            ->setLabel('E-mail')
            ->addFilter('StringTrim')
            ->addValidator('EmailAddress')
            ;

        $group_id = new Zend_Form_Element_Multiselect('group_id');
        $group_id
            ->setLabel('Group')
            ->setRequired(true)
            ->addFilter('StripTags')
            ->addFilter('StringTrim')
            ->addValidator('NotEmpty')
            ;

        $submit = new Zend_Form_Element_Submit('submit');

        $this->addElements(
            array($name, $login, $pass, $email, $group_id, $submit)
        );
    }
}
?>